/*
 * @Author: your name
 * @Date: 2021-11-09 16:30:21
 * @LastEditTime: 2021-12-04 21:13:23
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \li-yuwei\egg-example\app\router.js
 */
"use strict";

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = (app) => {
    const { router, controller } = app;
    //mock添加数据
    router.get("/insert", controller.article.insertList);
    //登录
    router.post("/login", controller.user.login);
    //注册
    router.post("/register", controller.user.register);
    //获取用户信息(单个)
    router.post("/user", controller.user.getUserInfo);
    //获取用户信息(全部)
    router.post("/user/all", controller.user.getAllUser);
    //修改用户信息
    router.put("/user/info", controller.user.editUserInfo);
    //修改密码
    router.put("/user", controller.user.changePassword);
    //改变用户可用状态
    router.put("/user/state", controller.user.changeUserState);
    //改变用户身份
    router.put("/user/identity", controller.user.changeUseIdentity);
    //批量启用
    router.put("/user/start", controller.user.batchUserStart);
    //批量禁用
    router.put("/user/forbid", controller.user.batchUserForbid);
    //批量授权
    router.put("/user/allow", controller.user.batchUserAllow);
    //批量解除授权
    router.put("/user/relieve", controller.user.batchUserRelieve);
    //刷新token
    router.get("/refresh", controller.user.refresh);

    // **************************************文章

    //获取数文章总个数
    router.get("/article", controller.article.getArticleTotal);
    //获取数文章详情
    router.get("/article/:id", controller.article.getDetail);
    //获取数文章详情
    router.put("/article", controller.article.editDetail);
    //获取最新文章
    router.post("/article/new", controller.article.getNewArticle);
    //获取数文章据列表
    router.post("/article", controller.article.getArticle);
    //新增文章
    router.post("/add/article", controller.article.addArticle);
    //改变文章首焦状态
    router.put("/articleFocus", controller.article.changeArticleFocus);
    //删除文章数据(单个)
    router.delete("/article", controller.article.delArticle);
    //删除文章数据(批量)
    router.delete("/batchArticle", controller.article.batchDelArticle);
    //批量发布
    router.put("/batchPubArticle", controller.article.batchPubArticle);
    //批量草稿
    router.put("/batchDftArticle", controller.article.batchDftArticle);
    //批量撤销
    router.put("/batchRemoveArticle", controller.article.batchRemoveArticle);
    //批量推荐
    router.put("/batchFocusArticle", controller.article.batchFocusArticle);
    // **************************************分类

    //获取分类数据
    router.get("/classify", controller.classify.getClassifyList);
    //获取分类个数
    router.get("/classify/num", controller.classify.getClassifyTotal);
    //添加分类
    router.post("/classify", controller.classify.addClassifyList);
    //删除分类
    router.delete("/classify", controller.classify.delClassifyList);
    //更新分类
    router.put("/classify", controller.classify.editClassifyList);

    // ******************************标签
    //获取标签
    router.get("/tag", controller.tag.getTagList);
    //获取标签个数
    router.get("/tag/num", controller.tag.getTagTotal);
    //添加标签
    router.post("/tag", controller.tag.addTagList);
    //删除标签
    router.delete("/tag", controller.tag.delTagList);
    //更新标签
    router.put("/tag", controller.tag.editTagList);

    // **************************页面***************

    //mock添加数据
    router.get("/insert/page", controller.page.insertList);
    //获取页面数据
    router.post("/page", controller.page.getPage);
    //获取页面详情据
    router.get("/page/:id", controller.page.getPageDetail);
    //添加页面
    router.post("/add/page", controller.page.addPage);
    //修改页面
    router.put("/edit/page", controller.page.editPage);
    //删除页面
    router.delete("/page", controller.page.delPage);
    //更改页面状态
    router.put("/page", controller.page.changePageState);
    //批量删除
    router.delete("/batchDelPage", controller.page.batchDelPage);
    //批量发布
    router.put("/batchPubPage", controller.page.batchPubPage);
    //批量下线
    router.put("/batchDftPage", controller.page.batchDftPage);
    //mock添加遇见数据
    router.get("/insert/email", controller.email.insertList);

    //************************** */ 邮件

    //获取邮件管理数据
    router.post("/email", controller.email.getEmail);
    //删除邮件
    router.delete("/email", controller.email.delEmail);
    //批量删除邮件
    router.delete("/batchDelEmail", controller.email.batchDelEmail);

    // *************************知识小册**************************
    //mock添加数据 (知识小册)
    router.get("/insert/knowledge", controller.knowledge.insertList);
    //获取知识小册数据
    router.post("/knowledge", controller.knowledge.getKnowledgeList);
    //添加知识小册数据
    router.post("/add/knowledge", controller.knowledge.addKnowledgeList);
    //删除知识小册数据
    router.delete("/knowledge", controller.knowledge.delKnowledgeList);
    //修改知识小册数据
    router.put("/knowledge", controller.knowledge.editKnowledgeList);
    //改变知识小册数据上线状态
    router.put("/alter/knowledge", controller.knowledge.changeKnowledgeState);
    //获取详情(一级)
    router.get("/knowledge/:id", controller.knowledge.getKnowledgeDetail);
    //获取二级内容
    router.get("/child/knowledge/:id", controller.knowledge.getKnowledgeChildren);
    //添加二级内容
    router.post("/child/add", controller.knowledge.addKnowledgeChildren);
    ///
    ///
    ///

    //*********************评论************************************** */
    //获取评论
    router.get("/comments", controller.comments.getCommentList);
    //添加评论
    router.post("/comments", controller.comments.addCommentList);
    //删除
    router.delete("/comments/:id", controller.comments.delCommentList);
    //改变发布状态
    router.put("/comments", controller.comments.changeCommentState);
    //批量删除
    router.delete("/batch/comments", controller.comments.batchDelComments);
    //批量通过
    router.put("/pass/comments", controller.comments.batchPassComments);
    //批量拒绝
    router.put("/refuse/comments", controller.comments.batchRefuseComments);
    //通过
    router.put("/pass/comment", controller.comments.passComment);
    //拒绝
    router.put("/refuse/comment", controller.comments.refuseComment);
    ///
    ///
    ///
    // ***************文件上传*****************//
    //更改知识小册图片
    router.post("/file/img", controller.knowledge.fileSetLoad);
    // ********************//
    //获取文件数据
    router.post("/file/list", controller.file.getFileList);
    //添加文件
    router.post("/file", controller.file.fileSetLoad);
    //删除文件
    router.delete("/file", controller.file.delFileList);

    router.put("/oss", controller.oss.upload);

    // *********** 用户端********************************************************************************************************************//

    //************page******* */

    //获取上线页面数据
    router.get("/client/page", controller.page.getPassPage);
    //获取详情
    router.get("/client/page/:path", controller.page.getDetailPage);

    // **********文章article**************//
    //搜索接口
    router.get("/client/article", controller.article.searchArticle);
    //推荐阅读
    router.get("/client/recommend/article", controller.article.recommendArticle);
    //获取上线文章
    router.get("/client/state/article", controller.article.getStateArticle);
    //首焦推荐轮播图数据
    router.get("/client/focus/article", controller.article.getFocusArticle);
    //阅读量++
    router.post("/client/reading/article", controller.article.addArticleReading);
    //点赞
    router.post("/client/likes/article", controller.article.addArticleLikes);
    //是否点赞
    router.post("/client/isLikes/article", controller.article.isArticleLikes);
    //**********标签************** */
    //获取标签文章个数
    router.get("/client/tag", controller.tag.getClientTag);
    //获取标签文章
    router.get("/client/tag/:text", controller.tag.getTagArticle);
    // *********分类classify***********************//
    router.get("/client/classify/:text", controller.classify.getClassifyArticle);
    //获取分类文章个数
    router.get("/client/classify", controller.classify.getClassifyNum);

    //*******************评论***************************
    //获取每个文章评论
    router.get("/client/comments/:id", controller.comments.getArticleComment);

    // ***************支付************************
    router.get("/client/pay", controller.pay.zhifubao);
};